/* CSS Reset - 重置浏览器默认样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 全局样式设置 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    transition: opacity 0.3s ease;
}

/* 页面加载动画 */
body.page-loading {
    opacity: 0;
}

body.page-loaded {
    opacity: 1;
}

/* 容器样式 - 用于限制内容宽度并居中 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* LOGO区样式 */
.logo-area {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 0;
    text-align: center;
}

.logo-area h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.logo-area p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* 导航栏样式 */
.navbar {
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.nav-brand h2 {
    color: #667eea;
    font-size: 1.5rem;
}

/* 导航菜单列表 */
.nav-menu {
    display: flex;
    list-style: none;
}

/* 导航链接样式 */
.nav-link {
    display: block;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.nav-link:hover {
    background-color: #f0f0f0;
    color: #667eea;
}

.nav-link.active {
    background-color: #667eea;
    color: white;
}

/* 主体内容区样式 */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 40px 0;
}

/* 首页样式 */
.hero-section {
    text-align: center;
    padding: 60px 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 10px;
    margin-bottom: 40px;
    transition: transform 0.3s ease;
}

.hero-section h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #333;
}

.hero-section p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    color: #666;
}

/* 首页按钮区域 */
.hero-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
}

/* 功能介绍区域 */
.features-section {
    margin-bottom: 50px;
}

.features-section h2,
.stats-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 40px;
    color: #333;
}

/* 功能卡片网格布局 */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

/* 功能卡片样式 */
.feature-card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
}

/* 功能图标样式 */
.feature-icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.feature-card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #333;
}

.feature-card p {
    color: #666;
    line-height: 1.6;
}

/* 统计数据网格布局 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* 统计数据卡片样式 */
.stat-card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: scale(1.05);
}

.stat-card h3 {
    font-size: 2rem;
    color: #667eea;
    margin-bottom: 10px;
}

.stat-card p {
    font-size: 1.1rem;
    color: #666;
}

/* 登录页面样式 */
.login-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

/* 登录卡片样式 */
.login-card {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-card h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

/* 表单组样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

/* 表单输入框样式 */
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* 表单错误状态样式 */
.form-group input.error {
    border-color: #e74c3c;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* 错误信息提示样式 */
.error-message {
    display: block;
    color: #e74c3c;
    font-size: 0.875rem;
    margin-top: 5px;
    min-height: 1.2rem;
}

/* 按钮基础样式 */
.btn {
    display: inline-block;
    padding: 12px 25px;
    background-color: #667eea;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: center;
    transform: scale(1);
}

.btn:hover {
    background-color: #5a6fd8;
    transform: scale(1.05);
}

.btn:active {
    transform: scale(0.98);
}

/* 块级按钮样式 */
.btn-block {
    display: block;
    width: 100%;
}

/* 主要按钮样式 */
.btn-primary {
    background-color: #667eea;
}

.btn-primary:hover {
    background-color: #5a6fd8;
}

/* 次要按钮样式 */
.btn-secondary {
    background-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

/* 表单底部链接区域 */
.form-footer {
    text-align: center;
    margin-top: 20px;
}

.form-footer a {
    color: #667eea;
    text-decoration: none;
}

.form-footer a:hover {
    text-decoration: underline;
}

/* 图书列表页面样式 */
.books-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 30px;
    color: #333;
}

/* 搜索栏样式 */
.search-bar {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
}

.search-bar input {
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    width: 300px;
    transition: border-color 0.3s ease;
}

.search-bar input:focus {
    outline: none;
    border-color: #667eea;
}

/* 图书网格布局 */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

/* 图书卡片样式 */
.book-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.book-card:hover {
    transform: translateY(-5px);
}

/* 图书封面样式 */
.book-cover {
    height: 200px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
}

/* 图书信息样式 */
.book-info {
    padding: 20px;
}

.book-info h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: #333;
}

.book-info p {
    color: #666;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

/* 图书操作按钮区域 */
.book-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.book-actions .btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.9rem;
}

/* 分页控件样式 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}

.pagination .btn {
    padding: 8px 15px;
    font-size: 0.9rem;
}

/* 图书分类页面样式 */
.categories-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 30px;
    color: #333;
}

/* 分类网格布局 */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

/* 分类卡片样式 */
.category-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.category-card:hover {
    transform: translateY(-5px);
}

/* 分类头部样式 */
.category-header {
    height: 150px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
}

/* 分类信息样式 */
.category-info {
    padding: 20px;
    text-align: center;
}

.category-info h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #333;
}

.category-info p {
    color: #666;
    font-size: 0.9rem;
    min-height: 3rem;
}

/* 分类下图书区域 */
.category-books-section {
    margin-top: 40px;
}

.category-books-section h3 {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 30px;
    color: #333;
}

/* 返回分类列表按钮区域 */
.back-to-categories {
    text-align: center;
    margin-top: 30px;
}

/* 个人中心页面样式 */
.profile-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 30px;
    color: #333;
}

/* 个人信息卡片样式 */
.profile-card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.profile-card h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #333;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

/* 借阅记录区域 */
.borrow-records {
    margin-top: 20px;
}

/* 借阅记录项样式 */
.borrow-record-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 5px;
    margin-bottom: 10px;
    background-color: #fafafa;
}

/* 借阅记录信息区域 */
.borrow-record-info {
    flex: 1;
}

.borrow-record-info h4 {
    margin-bottom: 5px;
    color: #333;
}

.borrow-record-info p {
    margin: 3px 0;
    color: #666;
    font-size: 0.9rem;
}

/* 借阅记录操作按钮区域 */
.borrow-record-actions {
    display: flex;
    gap: 10px;
}

.borrow-record-actions .btn {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* 未归还状态样式 */
.status-not-returned {
    color: #e74c3c;
    font-weight: bold;
}

/* 已归还状态样式 */
.status-returned {
    color: #27ae60;
    font-weight: bold;
}

/* 管理员页面样式 */
.admin-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 30px;
    color: #333;
}

/* 管理员导航区域 */
.admin-nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

/* 管理员内容区域 */
.admin-section-content {
    margin-top: 30px;
}

.admin-section-content h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #333;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

/* 管理员操作按钮区域 */
.admin-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.admin-actions .btn {
    padding: 8px 15px;
    font-size: 0.9rem;
}

/* 用户网格布局 */
.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* 用户卡片样式 */
.user-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    padding: 20px;
    transition: transform 0.3s ease;
}

.user-card:hover {
    transform: translateY(-5px);
}

.user-card h4 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #333;
}

.user-card p {
    color: #666;
    margin: 5px 0;
    font-size: 0.9rem;
}

/* 用户操作按钮区域 */
.user-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.user-actions .btn {
    flex: 1;
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* 管理员角色样式 */
.role-admin {
    color: #e74c3c;
    font-weight: bold;
}

/* 普通用户角色样式 */
.role-user {
    color: #3498db;
    font-weight: bold;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
    padding: 20px 0;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 模态框内容区域 */
.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideInModal 0.3s ease;
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
}

@keyframes slideInModal {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 关闭按钮样式 */
.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    right: 20px;
    top: 15px;
    cursor: pointer;
    z-index: 1001;
}

.close:hover,
.close:focus {
    color: #000;
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

.modal-content .form-group {
    margin-bottom: 20px;
}

.modal-content .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

/* 模态框表单输入框样式 */
.modal-content .form-group input,
.modal-content .form-group select,
.modal-content .form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.modal-content .form-group input:focus,
.modal-content .form-group select:focus,
.modal-content .form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* 模态框按钮样式 */
.modal-content .btn {
    display: block;
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    margin-top: 10px;
    box-sizing: border-box;
}

/* 模态框文本域样式 */
.modal-content .form-group textarea {
    min-height: 80px;
    resize: vertical;
}

/* 确保提交按钮始终可见 */
.modal-content form {
    display: flex;
    flex-direction: column;
}

.modal-content .form-group:last-child {
    margin-bottom: 0;
}

/* 页脚样式 */
.footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 20px 0;
}

.footer p {
    margin: 5px 0;
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .logo-area h1 {
        font-size: 2rem;
    }
    
    .navbar .container {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .hero-section h2 {
        font-size: 2rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .hero-buttons .btn {
        width: 80%;
    }
    
    .features-grid,
    .stats-grid,
    .categories-grid,
    .users-grid {
        grid-template-columns: 1fr;
    }
    
    .login-card {
        padding: 30px 20px;
    }
    
    .search-bar {
        flex-direction: column;
        align-items: center;
    }
    
    .search-bar input {
        width: 100%;
        max-width: 300px;
    }
    
    .borrow-record-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .borrow-record-actions {
        margin-top: 10px;
        align-self: flex-end;
    }
    
    .admin-nav {
        flex-direction: column;
        align-items: center;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
        margin: 10% auto;
        max-height: 80vh;
    }
}